package al.xc.task;

import java.util.Objects;

/**
 * task执行者
 */
public interface ILogicExecutor {
    /**
     * 执行体key
     */
    class ExecutorKey {
        Integer type_;
        Integer  index_;

        public ExecutorKey(Integer type, Integer index) {
            this.type_ = type;
            this.index_ = index;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (!(o instanceof ExecutorKey)) return false;
            ExecutorKey taskKey = (ExecutorKey) o;
            return (type_.equals(taskKey.type_) && index_.equals(taskKey.index_));
        }

        @Override
        public int hashCode() {
            return Objects.hash(type_, index_);
        }

        public Integer getType() {
            return type_;
        }

        public void setType(Integer type) {
            this.type_ = type;
        }

        public Integer getIndex() {
            return index_;
        }

        public void setIndex(Integer index) {
            this.index_ = index;
        }
    }

    /**
     * 执行
     * @param vl
     */
    void run(Object... vl) throws Exception;
}
